package top.toptimus.dto.dbSync.syncDatas;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Map;

@NoArgsConstructor
@AllArgsConstructor
@Data
/**
 * 机构DTO
 */
public class OgnizationDTO {
    private String ognization_name;     //机构名称
    private String ognization_id;     //机构ID

    /**
     * 数据放到map集合中
     *
     * @param map
     */
    public OgnizationDTO(Map<String, Object> map) {
        this.ognization_name = map.containsKey("ognization_name")?map.get("ognization_name").toString():"";
        this.ognization_id = map.containsKey("ognization_id")?map.get("ognization_id").toString():"";
    }

    /**
     * 将数据放入a_ognization_p表中
     *
     * @return sql
     */
    public String OgnizationDTOSql() {
        String sql = "INSERT INTO `fragsmart-erp`.`a_ognization_p` ( `ognization_name`, `ognization_id` )\n" +
                "VALUES\n" +
                "	( " + this.ognization_name + ", " + this.ognization_id + " );";

        return sql;
    }
}
